package com.loongtech.bi.action.realTime;

import com.loongtech.bi.action.PageHelper;
import com.loongtech.bi.entity.system.EntityBiChannel;
import com.loongtech.bi.entity.system.EntityBiPlatform;
import com.loongtech.bi.entity.system.EntityBiServer;
import com.loongtech.bi.manager.realTime.BossRealTimeManager;
import com.loongtech.bi.manager.realTime.OverviewManager;
import com.loongtech.bi.manager.realTime.OverviewManager.OverviewData;
import com.loongtech.bi.manager.realTime.OverviewManager.OverviewDetailData;
import com.loongtech.bi.manager.realTime.ServerRealTimeManager;
import com.loongtech.bi.manager.system.BiPlatformManager;
import com.loongtech.bi.manager.system.SysLogManager;
import com.loongtech.bi.support.Session;
import com.loongtech.bi.support.chart.ChartTool;
import com.loongtech.bi.support.chart.ChartUIData;
import com.loongtech.core.util.Time;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import javax.annotation.PostConstruct;
import java.util.*;

/**
 * 实时数据-实时概况Action
 * @author Marin
 * @date 2015年09月17日
 */

@Controller
@Scope("view")
//@RestController
public class OverviewAction {
	private Date lookDate = new Date(Time.getBeginningOfDay(Time.currentTime()));  // 前端传过来的查看时间
	private Date compareDate = new Date(Time.getBeginningOfDay(Time.currentTime() - Time.DAY));  // 前端传过来的对比时间
	private String queryPlatform = "0";  // 前端传过来的查询条件：平台
	private String queryChannel = "0";  // 前端传过来的查询条件：渠道
	private String queryServer = "0";  // 前端传过来的查询条件：区服
	private Map<String, String> platformItmes;  // 平台下拉列表
	private Map<String, String> channelItmes;  // 渠道下拉列表
	private Map<String, String> serverItmes;  // 区服下拉列表
	
	@SuppressWarnings({ "serial" })
	private Map<Integer, String> hourMap = new HashMap<Integer, String>() {
		{
			put(0, "00:00~00:59");
			put(1, "01:00~01:59");
			put(2, "02:00~02:59");
			put(3, "03:00~03:59");
			put(4, "04:00~04:59");
			put(5, "05:00~05:59");
			put(6, "06:00~06:59");
			put(7, "07:00~07:59");
			put(8, "08:00~08:59");
			put(9, "09:00~09:59");
			put(10, "10:00~10:59");
			put(11, "11:00~11:59");
			put(12, "12:00~12:59");
			put(13, "13:00~13:59");
			put(14, "14:00~14:59");
			put(15, "15:00~15:59");
			put(16, "16:00~16:59");
			put(17, "17:00~17:59");
			put(18, "18:00~18:59");
			put(19, "19:00~19:59");
			put(20, "20:00~20:59");
			put(21, "21:00~21:59");
			put(22, "22:00~22:59");
			put(23, "23:00~23:59");
		}
	};
	@SuppressWarnings({ "serial" })
    private Map<Integer, String> hourMap1 = new HashMap<Integer, String>() {
        {
            put(0, "00:00~00:59");
            put(1, "00:00~01:59");
            put(2, "00:00~02:59");
            put(3, "00:00~03:59");
            put(4, "00:00~04:59");
            put(5, "00:00~05:59");
            put(6, "00:00~06:59");
            put(7, "00:00~07:59");
            put(8, "00:00~08:59");
            put(9, "00:00~09:59");
            put(10, "00:00~10:59");
            put(11, "00:00~11:59");
            put(12, "00:00~12:59");
            put(13, "00:00~13:59");
            put(14, "00:00~14:59");
            put(15, "00:00~15:59");
            put(16, "00:00~16:59");
            put(17, "00:00~17:59");
            put(18, "00:00~18:59");
            put(19, "00:00~19:59");
            put(20, "00:00~20:59");
            put(21, "00:00~21:59");
            put(22, "00:00~22:59");
            put(23, "00:00~23:59");
        }
    };

    private List<ServerRealTimeManager.OnlineRealTimeData> onlineRealTimeDatas; // 项目整体实时在线数据
    private ChartUIData onlineRealTimeChart; // 项目整体实时在线图表

    private List<OverviewData> datas;  // 前端要显示的实时汇总数据
    private List<OverviewDetailData> detailDatas;  // 前端要显示的详细数据
    // private ChartUIData lineChart1;  // 前端要显示的曲线图数据-新增设备数
    private ChartUIData lineChart2;  // 前端要显示的曲线图数据-新增帐号数
    private ChartUIData lineChart20;  // 前端要显示的曲线图数据-去重新增帐号数
    private ChartUIData lineChart3;  // 前端要显示的曲线图数据-活跃帐号数
    private ChartUIData lineChart4;  // 前端要显示的曲线图数据-付费帐号数
    private ChartUIData lineChart5;  // 前端要显示的曲线图数据-付费金额
    private ChartUIData lineChart6;  // 前端要显示的曲线图数据-新增帐号付费数
    private ChartUIData lineChart7;  // 前端要显示的曲线图数据-新增帐号付费金额
	//public static AtomicInteger lastDatasHashCode = new AtomicInteger(0);  // 最近一次datas对象的hashCode

    private List<OverviewDetailData> detailDatas1;  // 前端要显示的详细数据
    // private ChartUIData lineChart1;  // 前端要显示的曲线图数据-新增设备数
    private ChartUIData lineChart21;  // 前端要显示的曲线图数据-新增帐号数
    private ChartUIData lineChart210;  // 前端要显示的曲线图数据-去重新增帐号数
    private ChartUIData lineChart31;  // 前端要显示的曲线图数据-活跃帐号数
    private ChartUIData lineChart41;  // 前端要显示的曲线图数据-付费帐号数
    private ChartUIData lineChart51;  // 前端要显示的曲线图数据-付费金额
    private ChartUIData lineChart61;  // 前端要显示的曲线图数据-新增帐号付费数
    private ChartUIData lineChart71;  // 前端要显示的曲线图数据-新增帐号付费金额

	private String lastUpdateTimeStr = "";  // 前端要访问的最近更新时间字符串

    // 缓存 key = lookDate + compareDate + queryPlatform + queryChannel + queryServer
   /* private static Map<String, List<OverviewData>> lastQueryDatas = new HashMap<>();
    private static Map<String, List<OverviewDetailData>> lastQueryDetailDatas = new HashMap<>();
    private static Map<String, String> lastLastUpdateTimeStr = new HashMap<>();
    private static final Map<String, Long> lastQueryTime = new HashMap<>();*/
	
	@Autowired
	OverviewManager overviewManager;
    @Autowired
    private BossRealTimeManager bossRealTimeManager;
    @Autowired
    private ServerRealTimeManager serverRealTimeManager;
	@Autowired
	private SysLogManager sysLogManager;
	@Autowired
	private Session session;
	
	@PostConstruct
	public void init() {
		initData();
		search();
	}
	
	// 初始化平台下拉列表
	public void initData() {
		platformItmes = new LinkedHashMap<>();
		platformItmes.put("全平台", "0");
		for (EntityBiPlatform p : BiPlatformManager.PLATFORM_LIST) {
			platformItmes.put(p.getName(), p.getId());
		}
		updateChannelItmes();
	}

    /*@RequestMapping(value="/overview.do")
	public List<OverviewData> searchRest(@RequestParam(value="serverid",required=false, defaultValue="0") String serverId) {

        HttpServletResponse response = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse();
        response.setHeader("Access-Control-Allow-Origin","*");
        System.out.println("serverid : " + serverId);

        List<OverviewData> res = new ArrayList<>();
        OverviewData o1 = overviewManager.new OverviewData();
        OverviewData o2 = overviewManager.new OverviewData();
        o1.setTitle("aaaaaa");
        o2.setTitle("bbbbbb");
        o1.setValue("dddddd");
        res.add(o1);
        res.add(o2);

	    return res;
    }*/

	public void search() {
		sysLogManager.addLog(session.getUserName(), "实时数据-实时概况");

        /*boolean isOld = false;  // 应该返回老数据
        String key = Time.getBeginningOfDay(lookDate.getTime()) + Time.getBeginningOfDay(compareDate.getTime()) + queryPlatform + queryChannel + queryServer;
        if ((Time.currentTime() - (lastQueryTime.get(key) == null ? 0L : lastQueryTime.get(key)))  < 2 * Time.MIN) {
            System.out.println("查询太频繁，不查数据库了，直接返回老数据");
            isOld = true;
        } else {
            System.out.println("查数据库");
            lastQueryTime.put(key, Time.currentTime());
        }*/

        Date lastWeekDate = new Date(Time.getBeginningOfDay(lookDate.getTime() - 7 * Time.DAY));  // 查看时间前几天的时间
        boolean ignore = Time.getInterval(Time.currentDate(), lookDate) != 0 || Time.getInterval(new Date(Time.currentTime() - Time.DAY), compareDate) != 0;

		lineChart2 = null;
        lineChart20 = null;
		lineChart3 = null;
		lineChart4 = null;
		lineChart5 = null;
		lineChart6 = null;
		lineChart7 = null;

        lineChart21 = null;
        lineChart210 = null;
        lineChart31 = null;
        lineChart41 = null;
        lineChart51 = null;
        lineChart61 = null;
        lineChart71 = null;

        //overviewManager.getSession().clear();

      /*  if(isOld && lastQueryDatas.get(key) != null) {
            datas = lastQueryDatas.get(key);
        } else {*/
            datas = overviewManager.getOverviewData(lookDate, queryPlatform, queryChannel, queryServer);  // 汇总数据
        /*    lastQueryDatas.put(key, datas);
        }*/

        //int maxHour = 0;  // 当时在线数据的最大小时
		if ("0".equals(queryPlatform) && "0".equals(queryChannel) && "0".equals(queryServer)) {  // 当查询的为全平台全渠道全服的数据时（登录网站默认），更新最近更新时间
           /* if(isOld && lastLastUpdateTimeStr.get(key) != null) {
                lastUpdateTimeStr = lastLastUpdateTimeStr.get(key);
            } else {*/
                long lastupdatetime = bossRealTimeManager.getMaxUpdateTime();
                lastUpdateTimeStr = "（最近一次更新时间为：" + Time.getCeil1(lastupdatetime) + ")";

           // maxHour = Time.getHour(lastupdatetime);


            /*    lastLastUpdateTimeStr.put(key, lastUpdateTimeStr);
            }*/
            /*
            if (datas != null && datas.hashCode() != lastDatasHashCode.intValue()) {  // 当本次datas的hashCode与上次的不相等时，更新最近一次更新时间字符串
				lastDatasHashCode.set(datas.hashCode());
				long lastupdatetime = Time.getBeginningOfDay(-1) > lookDate.getTime() ? Time.getBeginningOfDay(lookDate.getTime() + Time.DAY) : System.currentTimeMillis();
				lastUpdateTimeStr = "（最近一次更新时间为：" + Time.getCeil5(lastupdatetime) + ")";
			}*/
		}

       /* if(isOld && lastQueryDetailDatas.get(key) != null) {
            detailDatas = lastQueryDetailDatas.get(key);
        } else {*/
            detailDatas = overviewManager.getOverviewDetailData("1", lookDate, compareDate, lastWeekDate, queryPlatform, queryChannel, queryServer);  // 分时详细数据
        /*    lastQueryDetailDatas.put(key, detailDatas);
        }*/
		if (detailDatas != null && detailDatas.size() > 0) {
			//lineChart1 = new ChartUIData();
			//lineChart1.setSelectItem("newDeviceLookValue");
			//lineChart1.setJsonStr(new ChartTool(detailDatas, OverviewDetailData.class, lineChart1.getSelectItem()).loadData(lineChart1.getJsonType()));
			lineChart2 = new ChartUIData();
			lineChart2.setSelectItem("newUserLookValue");
            lineChart20 = new ChartUIData();
            lineChart20.setSelectItem("distinctNewUserLookValue");
            lineChart3 = new ChartUIData();
            lineChart3.setSelectItem("activeUserLookValue");
            lineChart4 = new ChartUIData();
            lineChart4.setSelectItem("payUserLookValue");
            lineChart5 = new ChartUIData();
            lineChart5.setSelectItem("payLookValue");
            lineChart6 = new ChartUIData();
            lineChart6.setSelectItem("newPayUserLookValue");
            lineChart7 = new ChartUIData();
            lineChart7.setSelectItem("newUserPayLookValue");
            if (ignore) {
                lineChart2.setJsonStr(new ChartTool(detailDatas, OverviewDetailData.class, lineChart2.getSelectItem(), "newUserLastWeekValue").loadData(lineChart2.getJsonType()));
                lineChart20.setJsonStr(new ChartTool(detailDatas, OverviewDetailData.class, lineChart20.getSelectItem(), "distinctNewUserLastWeekValue").loadData(lineChart20.getJsonType()));
                lineChart3.setJsonStr(new ChartTool(detailDatas, OverviewDetailData.class, lineChart3.getSelectItem(), "activeUserLastWeekValue").loadData(lineChart3.getJsonType()));
                lineChart4.setJsonStr(new ChartTool(detailDatas, OverviewDetailData.class, lineChart4.getSelectItem(), "payUserLastWeekValue").loadData(lineChart4.getJsonType()));
                lineChart5.setJsonStr(new ChartTool(detailDatas, OverviewDetailData.class, lineChart5.getSelectItem(), "payLastWeekValue").loadData(lineChart5.getJsonType()));
                lineChart6.setJsonStr(new ChartTool(detailDatas, OverviewDetailData.class, lineChart6.getSelectItem(), "newPayUserLastWeekValue").loadData(lineChart6.getJsonType()));
                lineChart7.setJsonStr(new ChartTool(detailDatas, OverviewDetailData.class, lineChart7.getSelectItem(), "newUserPayLastWeekValue").loadData(lineChart7.getJsonType()));
            } else {
                lineChart2.setJsonStr(new ChartTool(detailDatas, OverviewDetailData.class, lineChart2.getSelectItem()).loadData(lineChart2.getJsonType()));
                lineChart20.setJsonStr(new ChartTool(detailDatas, OverviewDetailData.class, lineChart20.getSelectItem()).loadData(lineChart20.getJsonType()));
                lineChart3.setJsonStr(new ChartTool(detailDatas, OverviewDetailData.class, lineChart3.getSelectItem()).loadData(lineChart3.getJsonType()));
                lineChart4.setJsonStr(new ChartTool(detailDatas, OverviewDetailData.class, lineChart4.getSelectItem()).loadData(lineChart4.getJsonType()));
                lineChart5.setJsonStr(new ChartTool(detailDatas, OverviewDetailData.class, lineChart5.getSelectItem()).loadData(lineChart5.getJsonType()));
                lineChart6.setJsonStr(new ChartTool(detailDatas, OverviewDetailData.class, lineChart6.getSelectItem()).loadData(lineChart6.getJsonType()));
                lineChart7.setJsonStr(new ChartTool(detailDatas, OverviewDetailData.class, lineChart7.getSelectItem()).loadData(lineChart7.getJsonType()));
            }

            Collections.sort(detailDatas, overviewManager.new OverviewDetailData().comparatorHour2);
		}

        detailDatas1 = overviewManager.getOverviewDetailData("2", lookDate, compareDate, lastWeekDate, queryPlatform, queryChannel, queryServer);  // 累计详细数据
        if (detailDatas1 != null && detailDatas1.size() > 0) {
            //lineChart1 = new ChartUIData();
            //lineChart1.setSelectItem("newDeviceLookValue");
            //lineChart1.setJsonStr(new ChartTool(detailDatas, OverviewDetailData.class, lineChart1.getSelectItem()).loadData(lineChart1.getJsonType()));


            lineChart21 = new ChartUIData();
            lineChart21.setSelectItem("newUserLookValue");
            lineChart210 = new ChartUIData();
            lineChart210.setSelectItem("distinctNewUserLookValue");
            lineChart31 = new ChartUIData();
            lineChart31.setSelectItem("activeUserLookValue");
            lineChart41 = new ChartUIData();
            lineChart41.setSelectItem("payUserLookValue");
            lineChart51 = new ChartUIData();
            lineChart51.setSelectItem("payLookValue");
            lineChart61 = new ChartUIData();
            lineChart61.setSelectItem("newPayUserLookValue");
            lineChart71 = new ChartUIData();
            lineChart71.setSelectItem("newUserPayLookValue");
            if (ignore) {
                lineChart21.setJsonStr(new ChartTool(detailDatas1, OverviewDetailData.class, lineChart21.getSelectItem(), "newUserLastWeekValue").loadData(lineChart21.getJsonType()));
                lineChart210.setJsonStr(new ChartTool(detailDatas1, OverviewDetailData.class, lineChart210.getSelectItem(), "distinctNewUserLastWeekValue").loadData(lineChart210.getJsonType()));
                lineChart31.setJsonStr(new ChartTool(detailDatas1, OverviewDetailData.class, lineChart31.getSelectItem(), "activeUserLastWeekValue").loadData(lineChart31.getJsonType()));
                lineChart41.setJsonStr(new ChartTool(detailDatas1, OverviewDetailData.class, lineChart41.getSelectItem(), "payUserLastWeekValue").loadData(lineChart41.getJsonType()));
                lineChart51.setJsonStr(new ChartTool(detailDatas1, OverviewDetailData.class, lineChart51.getSelectItem(), "payLastWeekValue").loadData(lineChart51.getJsonType()));
                lineChart61.setJsonStr(new ChartTool(detailDatas1, OverviewDetailData.class, lineChart61.getSelectItem(), "newPayUserLastWeekValue").loadData(lineChart61.getJsonType()));
                lineChart71.setJsonStr(new ChartTool(detailDatas1, OverviewDetailData.class, lineChart71.getSelectItem(), "newUserPayLastWeekValue").loadData(lineChart71.getJsonType()));
            } else {
                lineChart21.setJsonStr(new ChartTool(detailDatas1, OverviewDetailData.class, lineChart21.getSelectItem()).loadData(lineChart21.getJsonType()));
                lineChart210.setJsonStr(new ChartTool(detailDatas1, OverviewDetailData.class, lineChart210.getSelectItem()).loadData(lineChart210.getJsonType()));
                lineChart31.setJsonStr(new ChartTool(detailDatas1, OverviewDetailData.class, lineChart31.getSelectItem()).loadData(lineChart31.getJsonType()));
                lineChart41.setJsonStr(new ChartTool(detailDatas1, OverviewDetailData.class, lineChart41.getSelectItem()).loadData(lineChart41.getJsonType()));
                lineChart51.setJsonStr(new ChartTool(detailDatas1, OverviewDetailData.class, lineChart51.getSelectItem()).loadData(lineChart51.getJsonType()));
                lineChart61.setJsonStr(new ChartTool(detailDatas1, OverviewDetailData.class, lineChart61.getSelectItem()).loadData(lineChart61.getJsonType()));
                lineChart71.setJsonStr(new ChartTool(detailDatas1, OverviewDetailData.class, lineChart71.getSelectItem()).loadData(lineChart71.getJsonType()));
            }

            Collections.sort(detailDatas1, overviewManager.new OverviewDetailData().comparatorHour2);
        }

        onlineRealTimeDatas = new ArrayList<>(); // 项目整体实时在线数据
        onlineRealTimeChart = null; // 项目整体实时在线图表
        // 整体实时在线
        onlineRealTimeDatas = serverRealTimeManager.getOnlineRealTimeDatas(lookDate, compareDate, lastWeekDate, queryPlatform, queryChannel, queryServer);
        if (onlineRealTimeDatas != null && onlineRealTimeDatas.size() > 0) {
            onlineRealTimeChart = new ChartUIData();
            onlineRealTimeChart.setJsonStr(new ChartTool(onlineRealTimeDatas, ServerRealTimeManager.OnlineRealTimeData.class, onlineRealTimeChart.getSelectItem()).loadData(onlineRealTimeChart.getJsonType()));
        } else {
            onlineRealTimeChart = null;
        }
	}
	
	public String getHourStr(int hour){
		if(hour < 0 || hour >23){
			return "";
		}
		return hourMap.get(hour);
	}

    public String getHourStr1(int hour){
        if(hour < 0 || hour >23){
            return "";
        }
        return hourMap1.get(hour);
    }
	
	/**
	 * 更新渠道下拉列表为queryPlatform下的所有渠道
	 */
	public void updateChannelItmes() {
		if (!"0".equals(queryPlatform)) {
			channelItmes = new LinkedHashMap<>();
			channelItmes.put("全渠道", "0");
			serverItmes = new LinkedHashMap<>();
			serverItmes.put("全区服", "0");
			
			return;
		}
		
		List<EntityBiChannel> list = BiPlatformManager.getChannelIdsByPlatformId(queryPlatform);
		
		channelItmes = new LinkedHashMap<>();
		channelItmes.put("全渠道", "0");
		for (EntityBiChannel c : list) {
			channelItmes.put(c.getName(), c.getId());
		}
		
		updateServerItmes();
	}
	
	/**
	 * 更新区服下拉列表为channelIds下的所有区服
	 */
	public void updateServerItmes() {
		if (!"0".equals(queryChannel)) {
			platformItmes = new LinkedHashMap<>();
			platformItmes.put("全平台", "0");
			serverItmes = new LinkedHashMap<>();
			serverItmes.put("全区服", "0");
			
			return;
		}
		
		platformItmes = new LinkedHashMap<>();
		platformItmes.put("全平台", "0");
		for (EntityBiPlatform p : BiPlatformManager.PLATFORM_LIST) {
			platformItmes.put(p.getName(), p.getId());
		}
		
		// List<EntityBiServer> list = BiPlatformManager.getServerIdsByPlatAndChannId(queryPlatform, queryChannel);
		List<EntityBiServer> list = BiPlatformManager.SERVER_LIST;  // TODO 正式情况下，应该是上句，现在的情况是，没有区服渠道关联，所以渠道和平台为0时，直接返回全区服
		
		serverItmes = new LinkedHashMap<>();
		serverItmes.put("全区服", "0");
		for (EntityBiServer s : list) {
			serverItmes.put(s.getName(), s.getId());
		}
	}
	
	public void selectedServer() {
		if (!"0".equals(queryServer)) {
			platformItmes = new LinkedHashMap<>();
			platformItmes.put("全平台", "0");
			channelItmes = new LinkedHashMap<>();
			channelItmes.put("全渠道", "0");
			
			return;
		}
		
/*		platformItmes = new LinkedHashMap<>();
		platformItmes.put("全平台", "0");
		for (EntityBiPlatform p : BiPlatformManager.PLATFORM_LIST) {
			platformItmes.put(p.getName(), p.getId());
		}*/
		initData();
	}
	
	public Date getLookDate() {
		return lookDate;
	}

	public void setLookDate(Date lookDate) {
		this.lookDate = lookDate;
	}

	public Date getCompareDate() {
		return compareDate;
	}

	public void setCompareDate(Date compareDate) {
		this.compareDate = compareDate;
	}
	
	public String getQueryPlatform() {
		return queryPlatform;
	}

	public void setQueryPlatform(String queryPlatform) {
		this.queryPlatform = queryPlatform;
	}
	
	public String getQueryChannel() {
		return queryChannel;
	}

	public void setQueryChannel(String queryChannel) {
		this.queryChannel = queryChannel;
	}

	public String getQueryServer() {
		return queryServer;
	}

	public void setQueryServer(String queryServer) {
		this.queryServer = queryServer;
	}

	public Map<String, String> getPlatformItmes() {
		return platformItmes;
	}

	public void setPlatformItmes(Map<String, String> platformItmes) {
		this.platformItmes = platformItmes;
	}

	public Map<String, String> getChannelItmes() {
		return channelItmes;
	}

	public void setChannelItmes(Map<String, String> channelItmes) {
		this.channelItmes = channelItmes;
	}

	public Map<String, String> getServerItmes() {
		return serverItmes;
	}

	public void setServerItmes(Map<String, String> serverItmes) {
		this.serverItmes = serverItmes;
	}

	public List<OverviewData> getDatas() {
		return datas;
	}

	public void setDatas(List<OverviewData> datas) {
		this.datas = datas;
	}

	/*public ChartUIData getLineChart1() {
		return lineChart1;
	}

	public void setLineChart1(ChartUIData lineChart1) {
		this.lineChart1 = lineChart1;
	}*/

	public ChartUIData getLineChart2() {
		return lineChart2;
	}

	public void setLineChart2(ChartUIData lineChart2) {
		this.lineChart2 = lineChart2;
	}

	public ChartUIData getLineChart3() {
		return lineChart3;
	}

	public void setLineChart3(ChartUIData lineChart3) {
		this.lineChart3 = lineChart3;
	}

	public ChartUIData getLineChart4() {
		return lineChart4;
	}

	public void setLineChart4(ChartUIData lineChart4) {
		this.lineChart4 = lineChart4;
	}

	public ChartUIData getLineChart5() {
		return lineChart5;
	}

	public void setLineChart5(ChartUIData lineChart5) {
		this.lineChart5 = lineChart5;
	}

	public ChartUIData getLineChart6() {
		return lineChart6;
	}

	public void setLineChart6(ChartUIData lineChart6) {
		this.lineChart6 = lineChart6;
	}

	public ChartUIData getLineChart7() {
		return lineChart7;
	}

	public void setLineChart7(ChartUIData lineChart7) {
		this.lineChart7 = lineChart7;
	}

	public List<OverviewDetailData> getDetailDatas() {
		return detailDatas;
	}

	public void setDetailDatas(List<OverviewDetailData> detailDatas) {
		this.detailDatas = detailDatas;
	}

	public String getLastUpdateTimeStr() {
		return lastUpdateTimeStr;
	}

	public void setLastUpdateTimeStr(String lastUpdateTimeStr) {
		this.lastUpdateTimeStr = lastUpdateTimeStr;
	}

    public List<ServerRealTimeManager.OnlineRealTimeData> getOnlineRealTimeDatas() {
        return onlineRealTimeDatas;
    }

    public void setOnlineRealTimeDatas(List<ServerRealTimeManager.OnlineRealTimeData> onlineRealTimeDatas) {
        this.onlineRealTimeDatas = onlineRealTimeDatas;
    }

    public ChartUIData getOnlineRealTimeChart() {
        return onlineRealTimeChart;
    }

    public void setOnlineRealTimeChart(ChartUIData onlineRealTimeChart) {
        this.onlineRealTimeChart = onlineRealTimeChart;
    }

    public List<OverviewDetailData> getDetailDatas1() {
        return detailDatas1;
    }

    public void setDetailDatas1(List<OverviewDetailData> detailDatas1) {
        this.detailDatas1 = detailDatas1;
    }

    public ChartUIData getLineChart21() {
        return lineChart21;
    }

    public void setLineChart21(ChartUIData lineChart21) {
        this.lineChart21 = lineChart21;
    }

    public ChartUIData getLineChart31() {
        return lineChart31;
    }

    public void setLineChart31(ChartUIData lineChart31) {
        this.lineChart31 = lineChart31;
    }

    public ChartUIData getLineChart41() {
        return lineChart41;
    }

    public void setLineChart41(ChartUIData lineChart41) {
        this.lineChart41 = lineChart41;
    }

    public ChartUIData getLineChart51() {
        return lineChart51;
    }

    public void setLineChart51(ChartUIData lineChart51) {
        this.lineChart51 = lineChart51;
    }

    public ChartUIData getLineChart61() {
        return lineChart61;
    }

    public void setLineChart61(ChartUIData lineChart61) {
        this.lineChart61 = lineChart61;
    }

    public ChartUIData getLineChart71() {
        return lineChart71;
    }

    public void setLineChart71(ChartUIData lineChart71) {
        this.lineChart71 = lineChart71;
    }

    public ChartUIData getLineChart20() {
        return lineChart20;
    }

    public void setLineChart20(ChartUIData lineChart20) {
        this.lineChart20 = lineChart20;
    }

    public ChartUIData getLineChart210() {
        return lineChart210;
    }

    public void setLineChart210(ChartUIData lineChart210) {
        this.lineChart210 = lineChart210;
    }
    
    public String getColumnwidth(double val, double add){
    	return val > 0 ? PageHelper.double2Percent(val + add) : "0%";
    }
}
